package com.cloudkinto.enumType.order.inbound;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.cloudkinto.vo.common.CommonKvVo;

import java.util.ArrayList;
import java.util.Objects;

/**
 * 入库单状态库
 *
 * @author long
 */

public enum OrderInputStatusEnum implements IEnum<Integer> {

    /**
     *
     */
    zero(0, "草稿"),
    one(1, "待入库"),
    two(2, "收货中"),
    three(3, "已收货"),
    four(4, "已上架"),
    five(5, "已取消");

    private final Integer value;

    private final String desc;

    public String getDesc() {
        return desc;
    }

    OrderInputStatusEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return value;
    }

    public static String getDesc(Integer value) {
        for (OrderInputStatusEnum inputOrderStatus : values()) {
            if (Objects.equals(inputOrderStatus.getValue(), value)) {
                return inputOrderStatus.desc;
            }
        }
        return null;
    }

    public static ArrayList<CommonKvVo> getInputOrderStatusList() {
        ArrayList<CommonKvVo> list = new ArrayList<>();
        for (OrderInputStatusEnum inputOrderStatus : values()) {
            list.add(
                    CommonKvVo.builder()
                            .label(inputOrderStatus.desc)
                            .value(inputOrderStatus.getValue())
                            .build()
            );
        }
        return list;
    }
}
